﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using WS.EKA.FJYCM.Business.DAL;

namespace WS.EKA.FJYCM.WebUI.UserControls
{
    public partial class CoreBusinessSystem : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                rptBusinessSystem.DataSource = CoreBusinessSystemAccess.GetBusinessSystem();
                rptBusinessSystem.DataBind();
                IsAlertBind();
            }

        }

        public void IsAlertBind()
        {
            var redImg = "~/content/images/Switch_Red.png";
            if (CoreBusinessSystemAccess.IsAlertByIPAndType(lblRight1.Text, ""))
            {
                imgRight1.Src = redImg;
            }
            if (CoreBusinessSystemAccess.IsAlertByIPAndType(lblRight2.Text, ""))
            {
                imgRight2.Src = redImg;
            }
            if (CoreBusinessSystemAccess.IsAlertByIPAndType(lblLeft3.Text, ""))
            {
                imgCenter3.Src = redImg;
            }
            if (CoreBusinessSystemAccess.IsAlertByIPAndType(lblCenter4.Text, ""))
            {
                imgCenter4.Src = redImg;
            }
            if (CoreBusinessSystemAccess.IsAlertByIPAndType(lblLeft5.Text, ""))
            {
                imgLeft5.Src = redImg;
            }
            if (CoreBusinessSystemAccess.IsAlertByIPAndType(lblLeft6.Text, ""))
            {
                imgLeft6.Src = redImg;
            }
        }
    }
}